home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2005 October / PCWOCT05.iso / Software / FromTheMag / Ant Movie Catalog 3.5.0.2 / amc_install.exe / {app} / Scripts / CDUniverse.ifs < prev    next >
Text File  |  2005-03-13  |  3KB  |  85 lines

  1. (***************************************************
  2.  
  3. Ant Movie Catalog importation script
  4. www.antp.be/software/moviecatalog/
  5.  
  6. [Infos]
  7. Authors=NoFiX
  8. Title=CDUniverse
  9. Description=CDUniverse (Quick Picture Grab)
  10. Site=http://www.cduniverse.com
  11. Language=EN
  12. Version=
  13. Requires=3.5.0
  14. Comments=
  15. License=This program is free software; you can redistribute it and/or modify it under the  terms of the GNU General Public License as published by the Free Software Foundation;  either version 2 of the License, or (at your option) any later version. |
  16. GetInfo=1
  17.  
  18. [Options]
  19.  
  20. ***************************************************)
  21.  
  22. program CUPictureGrab;
  23. var
  24.   MovieName: string;
  25.  
  26. procedure AnalyzePage(Address: string);
  27. var
  28.   strPage, MovieAddr, MovieTitle, MovieDate, MovieID: string;
  29.   BeginPos, EndPos: Integer;
  30. begin
  31.   strPage := GetPage(Address);
  32.   BeginPos := Pos('<b>Click price', strPage);
  33.   if(BeginPos > -1)then
  34.     begin
  35.       PickTreeClear;
  36.       PickTreeAdd('Search Results for: ' + MovieName, '');
  37.       Delete(strPage, 1, BeginPos);
  38.       BeginPos := Pos('<a href="/productinfo.asp?', strPage);
  39.       EndPos := 1;
  40.       while ((BeginPos > 0) and (EndPos > 0)) do
  41.         begin
  42.           Delete(strPage, 1, BeginPos + 29);
  43.           EndPos := Pos('cart=', strPage) - 1;
  44.           MovieId := Copy(strPage, 1, EndPos - 1);
  45.           MovieAddr := 'http://www.cduniverse.com/productinfo.asp?pid=' + MovieId + '&cart=0&style=movie';
  46.           BeginPos := Pos('<b>', strPage) + 3;
  47.           EndPos := Pos('</b>', strPage);
  48.           MovieTitle := Copy(strPage, BeginPos, EndPos - BeginPos);
  49.           PickTreeAdd(MovieTitle, MovieAddr);
  50.           BeginPos := Pos('<a href="/productinfo.asp?', strPage);
  51.           if(Pos('</table>', strPage) < BeginPos) then
  52.            BeginPos := -1;
  53.         end;
  54.       if(PickTreeExec(Address)) then
  55.         begin
  56.           strPage := GetPage(Address);
  57.           if(Pos('default_coverart.gif', strPage) = 0) then
  58.             begin
  59.               BeginPos := Pos('<img src="http://cover', strPage) + 9;
  60.               Delete(strPage, 1, BeginPos);
  61.               EndPos := Pos('" border=', strPage) - 1;
  62.               //ShowMessage(Copy(strPage, 1, EndPos));
  63.               Address := Copy(strPage, 1, EndPos);
  64.               GetPicture(Address);
  65.             end
  66.           else
  67.             ShowMessage('Sorry, no cover-art was found for ' + MovieName);
  68.         end;
  69.     end;
  70. end;
  71.  
  72. begin
  73.   if CheckVersion(3,5,0) then
  74.   begin
  75.     MovieName := GetField(fieldOriginalTitle);
  76.     if MovieName = '' then
  77.       MovieName := GetField(fieldTranslatedTitle);
  78.     if Input('CDUniverse Import', 'Enter the title of the movie:', MovieName) then
  79.     begin
  80.       AnalyzePage('http://www.cduniverse.com/sresult.asp?cart=123456789&style=movie&HT_Search_Info=' + UrlEncode(MovieName));
  81.     end;
  82.   end else
  83.   ShowMessage('This script requires a newer version of Ant Movie Catalog (at least the version 3.5.0)');
  84. end.
  85.